//package com.uam.core.business.help;
//
//import com.alibaba.fastjson.JSONArray;
//import com.uam.core.business.mode.PointModel;
//import com.uam.core.entity.model.AircraftModel;
//import com.uam.core.service.RouteService;
//import com.uam.core.tool.DateUtils;
//import io.swagger.models.auth.In;
//
//import java.text.ParseException;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.LinkedHashMap;
//import java.util.Map;
//import java.util.concurrent.ConcurrentHashMap;
//
///**
// *
// * @author Administrator
// */
//public class PointToCacheHelp {
//    /**
//     * 缓存
//     */
//    public static Map<String, Map<Integer, PointModel>> cacheModle=new LinkedHashMap<>();
//
//    public static void setPointDataToCache(JSONArray points, Integer taskId,RouteService routeService, AircraftModel aircraftModel) throws ParseException {
//        int row=points.size();
//        for (int i = 0; i < row; i++) {
//            JSONArray point = points.getJSONArray(i);
//            Date time=getDate(point);
//            PointModel pointModel = new PointModel();
//            pointModel.setLat(point.getDouble(1));
//            pointModel.setLon(point.getDouble(0));
//            pointModel.setTime(time);
//            pointModel.setSpeed(aircraftModel.getSpeed());
//            pointModel.setMaxAltitude(aircraftModel.getMaxAltitude());
//            pointModel.setMinAltitude(aircraftModel.getMinAltitude());
//            pointModel.setSafeDistance(aircraftModel.getSafeDistance());
//            pointModel.setIndex(i);
//            if(i <row-1) {
//                pointModel.setNextTime(getDate(points.getJSONArray(i+1)));
//            }
//            String key=  DateUtils.parseDateToStrV2(time);
//            Map<Integer,PointModel> dataModlMap=new HashMap<>();
//            dataModlMap.put(taskId,pointModel);
//            cacheModle.put(key,dataModlMap);
//        }
//    }
//
//    public static Date getDate(JSONArray jsonArray){
//        Object time= jsonArray.get(3);
//        if(time instanceof  Date){
//          return  (Date) time;
//        }
//        time= jsonArray.get(4);
//        if(time instanceof  Date){
//            return  (Date) time;
//        }
//
//        time= jsonArray.get(5);
//        if(time instanceof  Date){
//            return  (Date) time;
//        }
//        throw new RuntimeException("时间格式错误");
//    }
//}
